package com.fintech.third.service;

import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.fintech.third.dao.AcLinkmanMobileMapper;
import com.fintech.third.model.AcLinkmanMobile;

@Service("acLinkmanMobileService")
public class AcLinkmanMobileServiceImpl implements AcLinkmanMobileService {
	@Autowired
	private AcLinkmanMobileMapper acLinkmanMobileMapper;

	@Override
	public void saveLinkmanInfos(List<AcLinkmanMobile> acLinkmanMobiles) {
		acLinkmanMobileMapper.saveLinkmanInfos(acLinkmanMobiles);
	}
	
	@Override
	public Date getLinkmanDataTime(String idFintechUmUser){
		return acLinkmanMobileMapper.getLinkmanDataTime(idFintechUmUser);
	}

	@Override
	public Map<String, Object> selectLinkManInfo(String userId) {
		Map<String, Object> result = new HashMap<String, Object>();
		List<Map<String, Object>> list = acLinkmanMobileMapper.selectLinkManInfo(userId);
		for (Map<String, Object>  map: list) {
			if(map.get("linkman_mobile_num") != null){
				result.put(map.get("linkman_mobile_num").toString(), map.get("linkman_name"));
			}
		}
		return result;
	}
}
